package com.chenliang.testfilter.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * @program: springboot-filter
 * @description:
 * @author: chenLiang
 * @create: 2022-08-04 16:36
 */
@WebFilter(urlPatterns = {"/demo/demo"},filterName ="filter02" ) // 启动类再添加@ServletComponentScan(basePackages = "com.chenliang.testfilter.filter")即可
public class Filter02 implements Filter {


    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("Filter02 init");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("Filter02 执行业务逻辑");
        filterChain.doFilter(servletRequest,servletResponse);
    }
}
